package cn.dujc.superkid.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * @author du
 * date 2018/8/2 下午2:54
 */
public class VideoIndexResult implements Parcelable {
    /**
     * id : 1
     * gname : 一年级
     * sorting : 10
     * know : [{"id":3,"k_name":"应用题","sorting":7,"knowlist":[{"id":422,"title":"摸彩球","posttime":1497780516,"is_learning":1},{"id":419,"title":"认识时间（1）","posttime":1501404297,"is_learning":1}]}]
     */

    private String id;//年级id
    private String gname;//年级名
    private String sorting;//排序
    private List<KnowEntity> know;//知识点列表

    public String getId() { return id;}

    public void setId(String id) { this.id = id;}

    public String getGname() { return gname;}

    public void setGname(String gname) { this.gname = gname;}

    public String getSorting() { return sorting;}

    public void setSorting(String sorting) { this.sorting = sorting;}

    public List<KnowEntity> getKnow() { return know;}

    public void setKnow(List<KnowEntity> know) { this.know = know;}

    @Override
    public int describeContents() { return 0; }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.id);
        dest.writeString(this.gname);
        dest.writeString(this.sorting);
        dest.writeTypedList(this.know);
    }

    public VideoIndexResult() {}

    protected VideoIndexResult(Parcel in) {
        this.id = in.readString();
        this.gname = in.readString();
        this.sorting = in.readString();
        this.know = in.createTypedArrayList(KnowEntity.CREATOR);
    }

    public static final Creator<VideoIndexResult> CREATOR = new Creator<VideoIndexResult>() {
        @Override
        public VideoIndexResult createFromParcel(Parcel source) {return new VideoIndexResult(source);}

        @Override
        public VideoIndexResult[] newArray(int size) {return new VideoIndexResult[size];}
    };

    public static class KnowEntity implements Parcelable {
        /**
         * id : 3
         * k_name : 应用题
         * sorting : 7
         * knowlist : [{"id":422,"title":"摸彩球","posttime":1497780516,"is_learning":1},{"id":419,"title":"认识时间（1）","posttime":1501404297,"is_learning":1}]
         */

        private String id;
        private String k_name;
        private String sorting;
        private List<KnowlistEntity> knowlist;//

        public String getId() { return id;}

        public void setId(String id) { this.id = id;}

        public String getK_name() { return k_name;}

        public void setK_name(String k_name) { this.k_name = k_name;}

        public String getSorting() { return sorting;}

        public void setSorting(String sorting) { this.sorting = sorting;}

        public List<KnowlistEntity> getKnowlist() { return knowlist;}

        public void setKnowlist(List<KnowlistEntity> knowlist) { this.knowlist = knowlist;}

        @Override
        public int describeContents() { return 0; }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.k_name);
            dest.writeString(this.sorting);
            dest.writeTypedList(this.knowlist);
        }

        public KnowEntity() {}

        protected KnowEntity(Parcel in) {
            this.id = in.readString();
            this.k_name = in.readString();
            this.sorting = in.readString();
            this.knowlist = in.createTypedArrayList(KnowlistEntity.CREATOR);
        }

        public static final Creator<KnowEntity> CREATOR = new Creator<KnowEntity>() {
            @Override
            public KnowEntity createFromParcel(Parcel source) {return new KnowEntity(source);}

            @Override
            public KnowEntity[] newArray(int size) {return new KnowEntity[size];}
        };
    }

    public static class KnowlistEntity implements Parcelable {
        /**
         * id : 422
         * title : 摸彩球
         * posttime : 1497780516
         * is_learning : 1
         */

        private String id;//知识点id
        private String title;//知识点
        private String posttime;//知识点添加时间戳
        private String is_learning;//是否已学习（1-未学习，2-已学习）

        public String getId() { return id;}

        public void setId(String id) { this.id = id;}

        public String getTitle() { return title;}

        public void setTitle(String title) { this.title = title;}

        public String getPosttime() { return posttime;}

        public void setPosttime(String posttime) { this.posttime = posttime;}

        public String getIs_learning() { return is_learning;}

        public void setIs_learning(String is_learning) { this.is_learning = is_learning;}

        @Override
        public int describeContents() { return 0; }

        @Override
        public void writeToParcel(Parcel dest, int flags) {
            dest.writeString(this.id);
            dest.writeString(this.title);
            dest.writeString(this.posttime);
            dest.writeString(this.is_learning);
        }

        public KnowlistEntity() {}

        protected KnowlistEntity(Parcel in) {
            this.id = in.readString();
            this.title = in.readString();
            this.posttime = in.readString();
            this.is_learning = in.readString();
        }

        public static final Creator<KnowlistEntity> CREATOR = new Creator<KnowlistEntity>() {
            @Override
            public KnowlistEntity createFromParcel(Parcel source) {return new KnowlistEntity(source);}

            @Override
            public KnowlistEntity[] newArray(int size) {return new KnowlistEntity[size];}
        };
    }

}
